package cate.game.play.buff.h;

import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;

/**
 * 无法行动和成为受击目标，结束时恢复 17% 生命值，冷却 6 回合
 */
public class 金身BH extends BuffHandler {

	private double 恢复系数;

	//恢复系数=1700
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		恢复系数 = args.getWDouble("恢复系数", 0d);
	}

	@Override
	public boolean noMoveWithCtrl() {
		return true;
	}

	@Override
	public void onAdd(ActionCtx action) {
		buff.owner.status.getGhost().addBuff(buff.tid);
	}

	@Override
	public void onInvalid(ActionCtx action, byte invalidReason) {
		buff.owner.status.getGhost().removeBuff(buff.tid);
		double v = buff.owner.attr.total().hpTotal() * 恢复系数;
		buff.owner.attr.buffHeal(action, buff.owner, v);
	}
}
